<extend name="./masterHome" />
<block name="content">

</div>
<!--头部结束-->
<!--中间开始-->
<div class="body-center">
    <div class="center-content">
        <!--头部开始-->
        <div class="content-header">
            <p>收获地址  <span>温馨提示：为了保证您的权益，防止黄牛倒卖，订单进入正在配货状态将不能修改收货地址和发票信息！</span></p>
        </div>
        <!--头部结束-->
        <!--地址选择开始-->

        <div class="content-address">
            <foreach name="accountsData" key="k" item="v">
            <div class="consignee-item">
                <span class="radio-img "></span>
                <label for="adress1" class="radio">
                    <input type="radio" name="adress" id="adress1" class="radio-select" value=""/><span class="e-name">{$v['name']}</span>，
                    <span class="city">
                        <span class="province_w">{$v['province']}</span>&nbsp;
                        <span class="city_w">{$v['city']}</span>&nbsp;
                        <span class="county_w">{$v['county']}</span>
                    </span>
                    <span class="city-particular">{$v['particular']}</span>，<span class="postcode">{$v['postcode']}</span>,<span class="codeNumber">{$v['phone']}</span>
                </label>
                <span class="compile"><a class="copyreader" href="javascript:;">编辑</a></span>
                <input type="hidden" id="hidden" value="{$v['aid']}">
            </div>

            </foreach>

            <!--添加新地址-->

            <div class="consignee-item new-ress">
                <span class="radio-img"></span>
                <label for="adress3" class="radio"><input type="radio" name="adress" id="adress3" class="radio-select"  value=""/>使用新地址</label>
            </div>
            <!--添加地址框-->
            <div class="add-address new">
                <!--<form action="" method="post">-->
                    <!--<div class="s-name">-->
                        <!--<h3 class="style"><b>*</b>收货人姓名</h3>-->
                        <!--<input type="text" class="public" name="name" id="name" placeholder="收货人姓名" value="" />-->
                    <!--</div>-->
                    <!--<div class="address-s">-->
                        <!--<h3 class="style"><b>*</b>地址</h3>-->


                        <!--&lt;!&ndash;*******************城市联动**************************&ndash;&gt;-->
                        <!--&lt;!&ndash;城市联动&ndash;&gt;-->
                        <!--<select name="province" id="area1"></select>-->
                        <!--<select name="city" id="area2"></select>-->
                        <!--<select name="county" id="area3"></select>-->



                        <!--&lt;!&ndash;城市联动&ndash;&gt;-->
                        <!--&lt;!&ndash;<input type="text" name="name" id="name" placeholder="收货人姓名" value="" />&ndash;&gt;-->
                        <!--<textarea name="particular" placeholder="路名或街道地址，门牌号 " id="particular" rows="" cols=""></textarea>-->
                    <!--</div>-->

                    <!--<div class="postcode">-->
                        <!--<h3 class="style"><b>&nbsp;</b>邮政编码</h3>-->
                        <!--<input type="text" class="public" name="postcode" id="postcode" placeholder="6位邮政编码" value="" />-->
                    <!--</div>-->
                    <!--<div class="shouji">-->
                        <!--<h3 class="style"><b>*</b>手机号码 </h3>-->
                        <!--<input type="text" class="public" name="phone" id="shouji" placeholder="11位手机号码" value="" />-->
                    <!--</div>-->
                    <!--<div class="btn-group">-->
                        <!--<input type="submit"  class="btn" id="btn-bao" value="保存"/>-->
                        <!--<a href="javascript:;" class="btn-qu btn">取消</a>-->
                    <!--</div>-->

                <!--</form>-->
            </div>
            <!--添加地址按钮-->
            <a href="javascript:;" class="new-address"></a>
            <!--添加新地址结束-->


            <!--编辑开始-->
            <div class="add-address edit">
                <form action="{:u('Home/Accounts/ajaxStore')}" method="post" id="form">
                    <div class="s-name">
                        <h3 class="style"><b>*</b>收货人姓名</h3>
                        <input type="text" class="public" name="name" id="name" placeholder="收货人姓名" value="" />
                    </div>






                    <div class="address-s">
                        <h3 class="style"><b>*</b>地址</h3>

                        <!--城市联动-->
                        <!--<input type="text" name="name" id="name" placeholder="收货人姓名" value="" />-->
                        <!--城市联动-->
                        <script>
                            $(function () {
                                area.init('area');
                                area.selected('贵州', '遵义', '习水县');
                            })
                        </script>
                        <select name="province" id="area1"></select>
                        <select name="city" id="area2"></select>
                        <select name="county" id="area3"></select>

                        <!--*******************城市联动**************************-->

                        <textarea name="particular" placeholder="路名或街道地址，门牌号 " id="particular" rows="" cols=""></textarea>
                    </div>

                    <div class="postcode">
                        <h3 class="style"><b>&nbsp;</b>邮政编码</h3>
                        <input type="text" class="public" name="postcode" id="postcode" placeholder="6位邮政编码" value="" />
                    </div>
                    <div class="shouji">
                        <h3 class="style"><b>*</b>手机号码 </h3>
                        <input type="text" class="public" name="phone" id="shouji" placeholder="11位手机号码" value="" />
                    </div>
                    <input type="hidden" name="aid" id="bianjihidden" value="">
                    <div class="btn-group">
                        <input type="submit"  class="btn" id="btn-bao" value="保存"/>
                        <a href="javascript:;" class="btn-qu btn">取消</a>
                    </div>

                </form>
            </div>
        </div>
        <!--地址选择结束-->
        <!--*********************编辑页面省市县的获取***************************-->
        <script>
            $(function () {
                //选中效果
                $('.copyreader').click(function(){
                    var city_w=$(this).parents('.consignee-item').find('.city .city_w').html();
                    var county_w=$(this).parents('.consignee-item').find('.city .county_w').html();
                    var province_w = $(this).parents('.consignee-item').find('.city .province_w').html();
                    area.selected(province_w,city_w,county_w);
                    var aid=$(this).parents('.consignee-item').find('#hidden').val();

                    $('#bianjihidden').val(aid)




                })
            });
    $('.new-address').click(function () {
         $('#bianjihidden').val('');
    })



        </script>

        <!--选项开始-->
        <div class="options">
            <div class="options-all">
                <div class="payment options-public">
                    <h3>支付方式</h3>
                </div>
                <div class="consignee-item new-ress">
                    <span class="radio-img pitchOn"></span>
                    <label for="payment" class="radio w122"><input type="radio" name="payment" id="payment" class="radio-select"  value=""/>在线支付</label>
                </div>
            </div>
            <div class="options-all">
                <div class="distribution options-public">
                    <h3>配送方式</h3>
                </div>
                <div class="consignee-item new-ress">
                    <span class="radio-img pitchOn"></span>
                    <label for="distribution" class="radio w122"><input type="radio" name="distribution" id="distribution" class="radio-select"  value=""/>免费配送</label>
                </div>
            </div>
            <div class="options-all invoice">
                <div class=" options-public">
                    <h3>发票信息</h3>
                </div>
                <div class="box-all" style="overflow: hidden;">
                    <div class="consignee-item new-ress left">
                        <span class="radio-img pitchOn"></span>
                        <label for="invoice" class="radio w122 no"><input type="radio" name="invoice" id="invoice" class="radio-select "  value=""/>不开发票</label>
                    </div>
                    <div class="consignee-item new-ress left">
                        <span class="radio-img "></span>
                        <label for="invoice1" class="radio w122 yes"><input type="radio" name="invoice" id="invoice1" class="radio-select "  value=""/>普通发票</label>

                    </div>
                </div>
                <div class="con">
                    <div class="text">发票内容：购买商品明细</div>
                    <div class="text">发票抬头：请确认单位名称正确，以免因名称错误耽搁您的报销。</div>
                    <div class="box-all" style="overflow: hidden; margin-top: 10px;">
                        <a href="javascript:;" class="geren tongyong active">个人</a>
                        <a href="javascript:;" class="danwei tongyong">单位</a>
                    </div>
                    <div class="danweiname" >
                        <div class="text">单位名称：</div>
                        <input type="text" name="danweiname" id="danweiname" value="" />
                    </div>
                </div>
            </div>

        </div>
        <!--选项结束-->
        <div class="options-all  goods">
            <div class="qingdan options-public" style="border: none;">
                <h3>商品清单</h3>
            </div>
            <div class="goodsList">
                <div class="title">
                    <ul>
                        <li class="l1">商品名称</li>
                        <li class="l2">单价</li>
                        <li class="l3">数量</li>
                        <li class="l4">合计</li>
                    </ul>
                </div>
            </div>

            <div class="goods-cont">
                <if condition="isset($jiesData)">
                <foreach name="jiesData" key="k" item="v">
                <ul>
                    <li style="padding: 13px;">
                        <div class="gc1">
                            <img src="__ROOT__/{$v['options']['img']}"/>
                            <span>{$v['name']}</span>
                        </div>
                        <div class="gc2">
                            ¥
                            <span>{$v['price']}</span>
                        </div>
                        <div class="gc3">
                            X
                            <span>{$v['num']}</span>
                        </div>
                        <div class="gc4">
                            ¥
                            <span>{$v['total']}</span>
                        </div>

                    </li>

                </ul>
                </foreach>
                </if>
            </div>

            <script>
                $(function () {
                    var num=0;
                    var total=0;
                    $.each($('.gc3 span'),function (red) {
                        num+=parseInt($(this).html())

                    });
                    $.each($('.gc4 span'),function () {
                        total+=parseInt($(this).html())
                    });

                    $('.zongji span.num').html(num)
                    $('.zongji .yingfu').html(total)
                    $('.zongji h3 span.zj').html(total)

                })
            </script>
            <!--总计-->
            <div class="zongji">
                <ul>
                    <li>
                        共<span class="color num">2</span>件
                    </li>
                    <li class="yingfu">
                        金额合计：<span>1416.00</span>元
                    </li>
                    <li>
                        优惠抵扣：<span>-0.00</span>元
                    </li>
                    <li>
                        配送费：<span>0</span>元
                    </li>
                    <li style="margin-top: 15px;">
                        <h3>应付总金额：<span class="color zj">1416.00</span>元</h3>
                    </li>
                </ul>
            </div>

            <!--确认地址-->
            <div class="mailTo">
                <p>寄送至：
                    <span class="m-city">
                        <span class="w-province"></span>
                        <span class="w-city"></span>
                        <span class="w-county"></span>
                    </span>
                    <span class="m-particular"></span></p>
                <p><span class="m-name"></span> (收件人) <span class="m-number"></span> </p>
            </div>
            <div class="" style="overflow: hidden;">
                <a href="javascript:;" class="liji">立即下单</a>
            </div>


            <script>
                $(function () {
                    $('.liji').click(function () {
                      var province_mr= $('.w-province').html();
                      var city_mr= $('.w-city').html();
                      var county_w=$('.w-county').html();
                      var num=$('.num').html();
                      var particular_mr= $('.m-particular').html();
                      var name_mr= $('.m-name').html();
                      //电话号码
                      var phone_mr=$('.m-number').html();
                      //组合地址
                      var address= province_mr+city_mr+county_w+particular_mr;
                      //总的价格
                      var total=parseInt($('.zj').html());
            $.post("{:u('ajaxorder',['gid'=>$_GET['gid']])}",{address:address,or_total:total,mobile:phone_mr,consignee:name_mr,quantity:num},function (r) {
                if(r.valid){
                    alert(r.msg);
                }
                location.href="{:u('home/Pay/index')}"+'?oid='+r.oid;

            },'json')


                    })
                })

            </script>

        </div>


    </div>
</div>
</block>


